package de.fmannan.wildit.domainmodel;

import java.util.Calendar;

public class Alarm
{

    private Calendar startTime;
    private Calendar interval;
    private Calendar endTime;
    private AlarmType alarmType;
    private boolean enabled;
    private int alarmId;

    public Alarm(int id,Calendar start, Calendar end, Calendar interval, boolean enabled,
	    AlarmType type)
    {
	startTime = start;
	this.interval = interval;
	endTime = end;
	alarmType = type;
	alarmId = id;
    }

    public Alarm(int id, Calendar startTime, Calendar endTime,  boolean enabled, AlarmType type)
    {
	this(id, startTime, null, endTime,  enabled, type);
    }

    public Calendar getStartTime()
    {
	return startTime;
    }

    public Calendar getInterval()
    {
	return interval;
    }

    public Calendar getEndTime()
    {
	return endTime;
    }

    public AlarmType getType()
    {
	return alarmType;
    }

    /**
     * @return a String representing the start time in the following format:
     *         HH:mm:ss.
     */
    public String getStartTimeAsString()
    {
	return CalendarConverter.CalendarToString(startTime, "HH:mm:ss");
    }

    /**
     * @return a String representing the interval in the following format:
     *         HH:mm:ss.
     */
    public String getIntervalAsString()
    {
	return CalendarConverter.CalendarToString(interval, "HH:mm:ss");
    }

    /**
     * @return a String representing the end time in the following format:
     *         HH:mm:ss.
     */
    public String getEndTimeAsString()
    {
	return CalendarConverter.CalendarToString(endTime, "HH:mm:ss");
    }

    public String getTypeAsString()
    {
	return alarmType.toString();
    }
    
    public boolean isEnabled()
    {
	return enabled;	
    }

}
